package com.sen.common.common.response;

import com.sen.common.common.inter.RespCodeEnum;
import lombok.Data;

import java.io.Serializable;

@Data
public class Head implements Serializable {

    private int code;
    private String msg;
    private Boolean success;

    public void setHeadSuccess() {
        this.code = ResultMsgEnum.SUCCESS.getCode();
        this.msg = ResultMsgEnum.SUCCESS.getMsg();
        this.success = ResultMsgEnum.SUCCESS.isSuccess();
    }

    public void setHeadSuccess(RespCodeEnum resultMsgEnum) {
        this.code = resultMsgEnum.getCode();
        this.msg = resultMsgEnum.getMsg();
        this.success = resultMsgEnum.isSuccess();
    }

    public void setHeadFailed() {
        this.code = ResultMsgEnum.FAILED.getCode();
        this.msg = ResultMsgEnum.FAILED.getMsg();
        this.success = ResultMsgEnum.FAILED.isSuccess();
    }

}
